# Multiboot header

#define ASM
#include "multiboot.h"

.global _start

#.set MULTIBOOT_PAGE_ALIGN, 1<<0
#.set MULTIBOOT_MEMORY_INFO, 1<<1

#.set MULTIBOOT_HEADER_MAGIC, 0x1BADB002
#.set MULTIBOOT_HEADER_FLAGS, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO 
#.set CHECKSUM, -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)

.align 4
.long MULTIBOOT_HEADER_MAGIC
.long MULTIBOOT_HEADER_FLAGS
.long CHECKSUM
	
//.set STACKSIZE, 0x4000
//.comm _sys_stack, STACKSIZE, 32

.extern system_stack

_start:
	//movl $(_sys_stack + STACKSIZE), %esp
	movl $(system_stack + 0x1000), %esp
	
	# reset EFLAGS
	pushl $0
	popf 
	
	push %eax  # multiboot magic #
	push %ebx  # multiboot data struct

	call _main
	hlt
